package xyz.riceball.common.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.riceball.common.entity.dto.SysLogDTO;
import xyz.riceball.common.entity.po.SysLogPO;
import xyz.riceball.common.service.SysLogService;
import xyz.riceball.framework.core.annotation.RbSysRequest;
import xyz.riceball.framework.core.bean.ApiController;
import xyz.riceball.framework.core.bean.ApiR;
import xyz.riceball.framework.core.bean.PageParam;

import javax.annotation.Resource;

/**
 * <p>
 * 系统日志
 * </p>
 *
 * @author xiaovcloud
 * @since 2022/7/28 20:17
 */
@Api(tags = "日志管理")
@RestController
@RequestMapping("/rb/api/sys/log")
@RbSysRequest
public class SysLogController extends ApiController {

    @Resource
    SysLogService sysLogService;

    /**
     * 分页查询所有数据
     *
     * @param pageParam 分页对象
     * @param sysLogDTO  查询实体
     * @return 所有数据
     */
    @ApiOperation(value = "分页查询日志")
    @GetMapping
    public ApiR<Page<SysLogPO>> selectPage(PageParam pageParam, SysLogDTO sysLogDTO) {
        return success(sysLogService.selectPage(PageParam.of(pageParam), sysLogDTO));
    }
}
